-
-
Notifications
You must be signed in to change notification settings - Fork 670
Reimplement strtod and parseFloat / strtod + Fix String.fromCodePoint + improve strtol #768
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@dcodeIO I also added some tests from tc39/test262 and found one issue. Plz don't merge this yet |
Ok. Now should be more right. I switched to approach for handling cc @dcodeIO |
It ready to re-review |
Regarding these failure cases: How bad is this practically? Are these merely edge cases? What do other standard libraries do? |
It has only corner cases for extremely large or small values. To improve this cases we should choose much more complex solution which I'll definitely implement later. But this solution is pretty enought for most cases. See this comment. And this affect only when |
I see, thanks. So this is due to limiting to 64 bits for intermediate values, right? If so, tempted to say that this might be as good as it gets at this point in time anyway, since emulating 128 bit floats without multi-value looks like it'd need a shadow stack / heap support anyway. Even if metallic did that with structs, we'd probably still want to use multi-value (2 x 64 bits passed via the execution stack). |
128-bit soft floats usually slower than 128-bit fixed points. So 128-bit modular algos much better and use for such cases pretty widely for double <-> string conversion and trig argument reduction (Payne Hanek approach for large arguments). But in case with double <-> string probably BigFloat128 better solution |
@dcodeIO Currently it's not absolutely ideal. I'll rewrite part for handling huge values but this require some refactoring because |
Thanks! |
parseFloat
/strtod
;String.fromCharCode
;parseInt
/strtol
.DONE